<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>knet: E:/knet-git/knet/knet/loop_api.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">knet
   &#160;<span id="projectnumber">1.4.5</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>结构体</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_885cc87fac2d91e269af0a5a959fa5f6.html">E:</a></li><li class="navelem"><a class="el" href="dir_4e74998c9a9305a116abc25fcf9a1edb.html">knet-git</a></li><li class="navelem"><a class="el" href="dir_a1c045b39f32066568ae964b52db514f.html">knet</a></li><li class="navelem"><a class="el" href="dir_f76d03789f0b12416cfffea59e2ed47d.html">knet</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">loop_api.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="a00078.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright (c) 2014-2015, dennis wang</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * All rights reserved.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * </span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Redistribution and use in source and binary forms, with or without</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * modification, are permitted provided that the following conditions are met:</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *     * Redistributions of source code must retain the above copyright</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *       notice, this list of conditions and the following disclaimer.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> *     * Redistributions in binary form must reproduce the above copyright</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *       notice, this list of conditions and the following disclaimer in the</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> *       documentation and/or other materials provided with the distribution.</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * </span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#ifndef LOOP_API_H</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#define LOOP_API_H</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00056.html">config.h</a>&quot;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="keyword">extern</span> <a class="code" href="a00033.html">kloop_t</a>* <a class="code" href="a00117_ga2e4181ebe9c1769be90bb8dc0e5cdffe.html#ga2e4181ebe9c1769be90bb8dc0e5cdffe">knet_loop_create</a>();</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="a00117_ga390ea3161f935d0d3a411df8752d8b9f.html#ga390ea3161f935d0d3a411df8752d8b9f">knet_loop_destroy</a>(<a class="code" href="a00033.html">kloop_t</a>* loop);</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="keyword">extern</span> <a class="code" href="a00005.html">kchannel_ref_t</a>* <a class="code" href="a00117_gac1f9a4848c06c2a6a2723d7b991b4394.html#gac1f9a4848c06c2a6a2723d7b991b4394">knet_loop_create_channel</a>(<a class="code" href="a00033.html">kloop_t</a>* loop, uint32_t max_send_list_len, uint32_t recv_ring_len);</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="keyword">extern</span> <a class="code" href="a00005.html">kchannel_ref_t</a>* <a class="code" href="a00117_gaddfd5a2709d0c26ada8a2dd3fd6a5b62.html#gaddfd5a2709d0c26ada8a2dd3fd6a5b62">knet_loop_create_channel_exist_socket_fd</a>(<a class="code" href="a00033.html">kloop_t</a>* loop, <a class="code" href="a00056_a0d9e0afbf02fb6ed6c5b1415dce51b05.html#a0d9e0afbf02fb6ed6c5b1415dce51b05">socket_t</a> socket_fd,</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    uint32_t max_send_list_len, uint32_t recv_ring_len);</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="a00117_ga37ab03493fb1ed037815f2cd951d762a.html#ga37ab03493fb1ed037815f2cd951d762a">knet_loop_run_once</a>(<a class="code" href="a00033.html">kloop_t</a>* loop);</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="a00117_gaaf104ae1337c32415bd1aa8df545ae31.html#gaaf104ae1337c32415bd1aa8df545ae31">knet_loop_run</a>(<a class="code" href="a00033.html">kloop_t</a>* loop);</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="a00117_ga9e04a2d06c79405f444aa53a26eedd90.html#ga9e04a2d06c79405f444aa53a26eedd90">knet_loop_exit</a>(<a class="code" href="a00033.html">kloop_t</a>* loop);</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="a00117_ga1eca6d310350a4545182666db28fb91f.html#ga1eca6d310350a4545182666db28fb91f">knet_loop_get_active_channel_count</a>(<a class="code" href="a00033.html">kloop_t</a>* loop);</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="a00117_ga8a8c7aee4eed09d50062a5f464cdba7a.html#ga8a8c7aee4eed09d50062a5f464cdba7a">knet_loop_get_close_channel_count</a>(<a class="code" href="a00033.html">kloop_t</a>* loop);</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="a00117_gaf1239ea65307d7dc588175c45947437b.html#gaf1239ea65307d7dc588175c45947437b">knet_loop_set_data</a>(<a class="code" href="a00033.html">kloop_t</a>* loop, <span class="keywordtype">void</span>* data);</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="keyword">extern</span> <a class="code" href="a00032.html">kloop_profile_t</a>* <a class="code" href="a00117_gafc6a946f7c7fd4fb0508ac0f88969da1.html#gafc6a946f7c7fd4fb0508ac0f88969da1">knet_loop_get_profile</a>(<a class="code" href="a00033.html">kloop_t</a>* loop);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* LOOP_API_H */</span><span class="preprocessor"></span></div>
<div class="ttc" id="a00117_gaddfd5a2709d0c26ada8a2dd3fd6a5b62_html_gaddfd5a2709d0c26ada8a2dd3fd6a5b62"><div class="ttname"><a href="a00117_gaddfd5a2709d0c26ada8a2dd3fd6a5b62.html#gaddfd5a2709d0c26ada8a2dd3fd6a5b62">knet_loop_create_channel_exist_socket_fd</a></div><div class="ttdeci">kchannel_ref_t * knet_loop_create_channel_exist_socket_fd(kloop_t *loop, socket_t socket_fd, uint32_t max_send_list_len, uint32_t recv_ring_len)</div><div class="ttdoc">使用已存在的套接字创建管道 </div><div class="ttdef"><b>Definition:</b> loop.c:263</div></div>
<div class="ttc" id="a00056_html"><div class="ttname"><a href="a00056.html">config.h</a></div></div>
<div class="ttc" id="a00117_gaf1239ea65307d7dc588175c45947437b_html_gaf1239ea65307d7dc588175c45947437b"><div class="ttname"><a href="a00117_gaf1239ea65307d7dc588175c45947437b.html#gaf1239ea65307d7dc588175c45947437b">knet_loop_set_data</a></div><div class="ttdeci">void knet_loop_set_data(kloop_t *loop, void *data)</div><div class="ttdoc">设置用户数据指针 </div><div class="ttdef"><b>Definition:</b> loop.c:448</div></div>
<div class="ttc" id="a00117_gaaf104ae1337c32415bd1aa8df545ae31_html_gaaf104ae1337c32415bd1aa8df545ae31"><div class="ttname"><a href="a00117_gaaf104ae1337c32415bd1aa8df545ae31.html#gaaf104ae1337c32415bd1aa8df545ae31">knet_loop_run</a></div><div class="ttdeci">int knet_loop_run(kloop_t *loop)</div><div class="ttdoc">运行事件循环直到调用knet_loop_exit() kloop_t不是线程安全的，不能在多个线程内同时对同一个kloop_t实例调...</div><div class="ttdef"><b>Definition:</b> loop.c:284</div></div>
<div class="ttc" id="a00117_ga9e04a2d06c79405f444aa53a26eedd90_html_ga9e04a2d06c79405f444aa53a26eedd90"><div class="ttname"><a href="a00117_ga9e04a2d06c79405f444aa53a26eedd90.html#ga9e04a2d06c79405f444aa53a26eedd90">knet_loop_exit</a></div><div class="ttdeci">void knet_loop_exit(kloop_t *loop)</div><div class="ttdoc">退出函数knet_loop_run() </div><div class="ttdef"><b>Definition:</b> loop.c:297</div></div>
<div class="ttc" id="a00117_ga2e4181ebe9c1769be90bb8dc0e5cdffe_html_ga2e4181ebe9c1769be90bb8dc0e5cdffe"><div class="ttname"><a href="a00117_ga2e4181ebe9c1769be90bb8dc0e5cdffe.html#ga2e4181ebe9c1769be90bb8dc0e5cdffe">knet_loop_create</a></div><div class="ttdeci">kloop_t * knet_loop_create()</div><div class="ttdoc">创建一个事件循环 </div><div class="ttdef"><b>Definition:</b> loop.c:97</div></div>
<div class="ttc" id="a00117_ga1eca6d310350a4545182666db28fb91f_html_ga1eca6d310350a4545182666db28fb91f"><div class="ttname"><a href="a00117_ga1eca6d310350a4545182666db28fb91f.html#ga1eca6d310350a4545182666db28fb91f">knet_loop_get_active_channel_count</a></div><div class="ttdeci">int knet_loop_get_active_channel_count(kloop_t *loop)</div><div class="ttdoc">获取活跃管道数量 </div><div class="ttdef"><b>Definition:</b> loop.c:423</div></div>
<div class="ttc" id="a00005_html"><div class="ttname"><a href="a00005.html">_channel_ref_t</a></div><div class="ttdef"><b>Definition:</b> channel_ref.c:61</div></div>
<div class="ttc" id="a00032_html"><div class="ttname"><a href="a00032.html">_loop_profile_t</a></div><div class="ttdef"><b>Definition:</b> loop_profile.c:30</div></div>
<div class="ttc" id="a00056_a0d9e0afbf02fb6ed6c5b1415dce51b05_html_a0d9e0afbf02fb6ed6c5b1415dce51b05"><div class="ttname"><a href="a00056_a0d9e0afbf02fb6ed6c5b1415dce51b05.html#a0d9e0afbf02fb6ed6c5b1415dce51b05">socket_t</a></div><div class="ttdeci">#define socket_t</div><div class="ttdef"><b>Definition:</b> config.h:88</div></div>
<div class="ttc" id="a00033_html"><div class="ttname"><a href="a00033.html">_loop_t</a></div><div class="ttdef"><b>Definition:</b> loop.c:36</div></div>
<div class="ttc" id="a00117_ga8a8c7aee4eed09d50062a5f464cdba7a_html_ga8a8c7aee4eed09d50062a5f464cdba7a"><div class="ttname"><a href="a00117_ga8a8c7aee4eed09d50062a5f464cdba7a.html#ga8a8c7aee4eed09d50062a5f464cdba7a">knet_loop_get_close_channel_count</a></div><div class="ttdeci">int knet_loop_get_close_channel_count(kloop_t *loop)</div><div class="ttdoc">获取已关闭管道数量 </div><div class="ttdef"><b>Definition:</b> loop.c:428</div></div>
<div class="ttc" id="a00117_ga390ea3161f935d0d3a411df8752d8b9f_html_ga390ea3161f935d0d3a411df8752d8b9f"><div class="ttname"><a href="a00117_ga390ea3161f935d0d3a411df8752d8b9f.html#ga390ea3161f935d0d3a411df8752d8b9f">knet_loop_destroy</a></div><div class="ttdeci">void knet_loop_destroy(kloop_t *loop)</div><div class="ttdoc">销毁事件循环 事件循环内的所有管道也会被销毁 </div><div class="ttdef"><b>Definition:</b> loop.c:135</div></div>
<div class="ttc" id="a00117_ga37ab03493fb1ed037815f2cd951d762a_html_ga37ab03493fb1ed037815f2cd951d762a"><div class="ttname"><a href="a00117_ga37ab03493fb1ed037815f2cd951d762a.html#ga37ab03493fb1ed037815f2cd951d762a">knet_loop_run_once</a></div><div class="ttdeci">int knet_loop_run_once(kloop_t *loop)</div><div class="ttdoc">运行一次事件循环 kloop_t不是线程安全的，不能在多个线程内同时对同一个kloop_t实例调用knet_loop_run_once...</div><div class="ttdef"><b>Definition:</b> loop.c:278</div></div>
<div class="ttc" id="a00117_gafc6a946f7c7fd4fb0508ac0f88969da1_html_gafc6a946f7c7fd4fb0508ac0f88969da1"><div class="ttname"><a href="a00117_gafc6a946f7c7fd4fb0508ac0f88969da1.html#gafc6a946f7c7fd4fb0508ac0f88969da1">knet_loop_get_profile</a></div><div class="ttdeci">kloop_profile_t * knet_loop_get_profile(kloop_t *loop)</div><div class="ttdoc">取得统计器 </div><div class="ttdef"><b>Definition:</b> loop.c:458</div></div>
<div class="ttc" id="a00117_gac1f9a4848c06c2a6a2723d7b991b4394_html_gac1f9a4848c06c2a6a2723d7b991b4394"><div class="ttname"><a href="a00117_gac1f9a4848c06c2a6a2723d7b991b4394.html#gac1f9a4848c06c2a6a2723d7b991b4394">knet_loop_create_channel</a></div><div class="ttdeci">kchannel_ref_t * knet_loop_create_channel(kloop_t *loop, uint32_t max_send_list_len, uint32_t recv_ring_len)</div><div class="ttdoc">创建管道 </div><div class="ttdef"><b>Definition:</b> loop.c:268</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
生成于 2015年 七月 27日 星期一 14:33:19 , 为 knet使用  &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
